package main.java.DMDE.persistence;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import main.java.DMDE.model.Type;
import main.java.common.IXmlManager;

public class TypeXmlManager implements IXmlManager<Type> {

	public Element getElementFromItem(Type type, Document document) {
		Element typeElement = document.createElement("type");
		typeElement.setAttribute("name", type.getName().toString());
		return typeElement;
	}

	@Override
	public Type getItemFromXmlElement(Element element) throws Exception {
		Type type = new Type();
		type.setName(element.getAttribute("name"));
		return type;
	}
}
